/*
 * @Author: tongtong3
 * @Date: 2020-04-16 11:45:36
 * @LastEditTime: 2020-05-07 19:00:29
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \pmclouds-web\src\pages\PersonnelFiles\tpl\formTpl.js
 */
import { vendorsDanger as danger , vendorsWarning as warning} from './../../../utils/config.js';

function FormItems () {
    console.log(this,"form==")
    let _this = this;
    return{
        items: [
            {
                itemtype: "input",
                attrcode: 'name',
                refPk: 'name',
                label: "企业名称",
                required: true,
               
            },
            {
                itemtype: "select",
                attrcode: 'role',
                refPk: 'value',
                selectOptions:[
                    {key:10, value:10,label:"业主方"},
                    {key:20, value:20,label:"施工方"},
                    {key:30, value:30,label:"监理方"},
                    {key:40, value:40,label:"设计方"},
                    {key:50, value:50,label:"客户方"}
                ],
                label: "企业角色",
                isMultiSelectedEnabled: false,
                required: true,
                defaultValue: {value:10,label:"业主方", display:'业主方'}, 
            },
            {
                attrcode: 'planAuthorizedNum',
                label: '计划授权数',
                required: false,
                defaultValue: {value:'0', display:'0'}, 
            },
            {
                attrcode: 'realAuthorizedNum',
                label: '实际授权数',
                required: false,
                disabled : true,
            },
          
        ],
        afterEvent: (attrcode, oldvalue, value) => {
            if (attrcode == 'planAuthorizedNum') {
                let realAuthorizedNum =_this.props.form.getFormItemValue('realAuthorizedNum') && _this.props.form.getFormItemValue('realAuthorizedNum').value ||0;
                if(realAuthorizedNum > value&&value.value){
                    warning({text:`实际授权数${value.value}不得超过计划授权数`});
                }
            } 
        }
    }
    
}

export{FormItems} ;